package com.cnbot.aimolib.bean;

import android.graphics.PointF;
import android.graphics.RectF;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ytf
 * Created by on 2021/06/05 10:55
 */
public class AimoOutlineData {

    /**ImoFaceInfo的id，每次识别完成返回，每识别一个人脸就会加一*/
    public int faceId;
    public RectF faceRect;
    public PointF leftEye;
    public PointF rightEye;
    public PointF nose;
    public PointF leftMonth;
    public PointF rightMouth;
    public List<PointF> points;
    
    public void mapPoints(float[] points){
        if(points.length == 10){
            leftEye = new PointF(points[0], points[1]);
            rightEye = new PointF(points[2], points[3]);
            nose = new PointF(points[4], points[5]);
            leftMonth = new PointF(points[6], points[7]);
            rightMouth = new PointF(points[8], points[9]);
            collect();
        }
    }

    public void mapRect(RectF src){
        faceRect = new RectF(src.left, src.top, src.right, src.bottom);
    }

    private void collect(){
        points = new ArrayList<>();
        points.add(leftEye);
        points.add(rightEye);
        points.add(nose);
        points.add(leftMonth);
        points.add(rightMouth);
    }

    @Override
    public String toString() {
        return "faceId = " + faceId + ", face [" + faceRect.left + "," + faceRect.top + "," + faceRect.right + "," + faceRect.bottom + "], "
                + " leftEye " + leftEye
                + " rightEye " + rightEye
                + " nose " + nose
                + " leftMouth " + leftMonth
                + " rightMouth " + rightMouth;
    }
}
